home *** CD-ROM | disk | FTP | other *** search
- @@creat - create unbuffered io file.
- $$ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
- █ THIS IS A SAMPLE OF THE SOFTEK C LANGUAGE REFERENCE FILE █
- █ The complete C Language On-Line Reference files will soon █
- █ be available for purchase from SofTek for only $9.95 █
- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
-
- ╔═════════════════════════════════════════════════════════════════════════════╗
- ║ NAME: creat ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ DESCRIPTION: create a file and open for unbuffered i/o. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ USAGE: creat(name,pmode) ║
- ║ char *name; ║
- ║ int pmode; ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ NOTES: creat() creates a file and opens it for unbuffered, write-only ║
- ║ access. If the file already exists, it is truncated so that ║
- ║ nothing is in it. creat() returns as its value an integer called ║
- ║ a 'file descriptor'. Whenever a call is made to one of the ║
- ║ unbuffered i/o functions to access the file, its file descriptor ║
- ║ must be included in the functions parameters. ║
- ║ NAME is a pointer to a character string which is the name of the ║
- ║ device or file to be opened. ║
- ║ PMODE is optional. If specified, it is ignored. It should be ║
- ║ included, however, for programs for which UNIX compatibility ║
- ║ is required, since the UNIX creat() function requires it. In ║
- ║ this case, PMODE should have the octal value 0666. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ ERROR INFO: If creat() fails, it returns -1 as its value and sets a code ║
- ║ in the global integer ERRNO. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ LIBRARY: x.lib ║
- ║ ║
- ╚═════════════════════════════════════════════════════════════════════════════╝
- @@exp - compute exponential.
- $$ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
- █ THIS IS A SAMPLE OF THE SOFTEK C LANGUAGE REFERENCE FILE █
- █ The complete C Language On-Line Reference files will soon █
- █ be available for purchase from SofTek for only $9.95 █
- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
-
- ╔═════════════════════════════════════════════════════════════════════════════╗
- ║ NAME: exp ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ DESCRIPTION: compute exponential. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ USAGE: double exp(x) ║
- ║ double x; ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ NOTES: none. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ ERROR INFO: If unsuccessful, the function sets an error code in the global ║
- ║ integer ERRNO and returns an arbitrary value; otherwise ║
- ║ it returns the computed value without modifying ERRNO. The ║
- ║ symbolic values which the function can place in ERRNO are ║
- ║ EDOM, signifying that the argument was invalid, and ERANGE, ║
- ║ meaning that the value of the function couldn't be computed. ║
- ║ The codes are defined in the file 'errno.h'. ║
- ║ The following table lists the errorcodes that can be returned, ║
- ║ the function value for that error, and the meaning of the ║
- ║ error. The symbolic values are defined in the file 'math.h'. ║
- ║ ║
- ║ ****************************************************************║
- ║ * function | error | f(x) | meaning *║
- ║ *============|============|=============|======================*║
- ║ * exp | ERANGE | HUGE | x > LOGHUGE *║
- ║ * exp | ERANGE | 0.0 | x < LOGTINY *║
- ║ ****************************************************************║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ LIBRARY: x.lib ║
- ║ ║
- ╚═════════════════════════════════════════════════════════════════════════════╝
- @@fopen - open buffered io stream.
- $$ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
- █ THIS IS A SAMPLE OF THE SOFTEK C LANGUAGE REFERENCE FILE █
- █ The complete C Language On-Line Reference files will soon █
- █ be available for purchase from SofTek for only $9.95 █
- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
-
- ╔═════════════════════════════════════════════════════════════════════════════╗
- ║ NAME: fopen ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ DESCRIPTION: open i/o stream. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ USAGE: FILE *fopen(filename, mode) ║
- ║ char *filename, *mode; ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ NOTES: fopen() opens the device or file specified by the FILENAME parameter ║
- ║ for access by the standard i/o functions specified by the MODE ║
- ║ parameter. The open file or device is called a 'stream'. ║
- ║ If the file or device is successfully opened, the function returns ║
- ║ a file pointer to a structure of type file. This file pointer ║
- ║ will be used for future accesses to the open stream. ║
- ║ MODE points to a character string which specifies how the user's ║
- ║ program intends to access the stream. The choices are as follows: ║
- ║ r - Open for reading only. If a file is opened, it is positioned ║
- ║ at the first character in it. If the file or device does not ║
- ║ exist, NULL is returned. ║
- ║ w - Open for writing only. If a file is opened which already ║
- ║ exist, it is truncated to zero length. If the file does ║
- ║ not exist, it is created. ║
- ║ a - Open for appending. The calling program is granted write only ║
- ║ access to the stream. The current file position is the ║
- ║ character after the last character in the file. If the file ║
- ║ does not exist, it is created. ║
- ║ x - Open for writing. The file must NOT previously exist. This ║
- ║ option is NOT supported by UNIX. ║
- ║ r+ - Open for reading and writing. Same as 'r', but the stream ║
- ║ may also be written to. ║
- ║ w+ - Open for writing and reading. Same as 'w', but the stream ║
- ║ may also be read; different from 'r+' in the creation of a ║
- ║ new file and loss of any previous one. ║
- ║ a+ - Open for appending and reading. Same as 'a' but the stream ║
- ║ may also be read; different from 'r+' in file positioning ║
- ║ and file creation. ║
- ║ x+ - Open for writing and reading. Same as 'x' but the file can ║
- ║ also be read. ║
- ║ On systems which don't keep track of the last character in a file ║
- ║ (such as CP/M and Apple DOS), not all files can be correctly ║
- ║ positioned when opened in append mode. ║
- ║ FILENAME is a pointer to a character string which is the name ║
- ║ of the device or file to be opened. ║
- ║ The header 'stdio.h' must be included before this function can ║
- ║ be used. ║
- ║ EXAMPLE: ║
- ║ if ((fp = fopen(*fname, *fmode)) == NULL) ║
- ║ printf("unable to open specified file"); ║
- ║ else ║
- ║ printf("file is open"); ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ ERROR INFO: If the file or device cannot be opened, NULL is returned and ║
- ║ an error code is set in the global integer ERRNO. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ LIBRARY: x.lib ║
- ║ ║
- ╚═════════════════════════════════════════════════════════════════════════════╝
- @@fread - read binary data from a buffered io stream.
- $$ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
- █ THIS IS A SAMPLE OF THE SOFTEK C LANGUAGE REFERENCE FILE █
- █ The complete C Language On-Line Reference files will soon █
- █ be available for purchase from SofTek for only $9.95 █
- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
-
- ╔═════════════════════════════════════════════════════════════════════════════╗
- ║ NAME: fread ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ DESCRIPTION: read binary data from an i/o stream. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ USAGE: int fread(buffer, size, count, stream) ║
- ║ char *buffer; ║
- ║ int size, count; ║
- ║ FILE *stream; ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ NOTES: fread() performs a buffered input operation to the open stream ║
- ║ specified by the parameter STREAM. ║
- ║ BUFFER is the address of the user's buffer which will be used ║
- ║ for the operation. ║
- ║ The function reads COUNT items, each containing SIZE bytes, from ║
- ║ the stream. ║
- ║ The function performs i/o using the function getc(), thus no ║
- ║ translations occur on the data being transferred. ║
- ║ The function returns as its value the number of items actually ║
- ║ read. ║
- ║ The header 'stdio.h' must be included before use of this function. ║
- ║ EXAMPLE ║
- ║ This is the code for reading ten integers from file 1 and writing ║
- ║ then again to file 2. It includes a simple check that there are ║
- ║ enough two-byte items in the first file: ║
- ║ #include "stdio.h" ║
- ║ main() ║
- ║ { ║
- ║ FILE *fp1, *fp2, *fopen(); ║
- ║ char *buf; ║
- ║ int size = 2, count = 10; ║
- ║ ║
- ║ fp1 = fopen("file1","r"); ║
- ║ fp2 = fopen("file2","w"); ║
- ║ if (fread(buf, size, count, fp1) != count) ║
- ║ printf("Not enough integers in file 1\n"); ║
- ║ fwrite(buf, size, count, fp2); ║
- ║ } ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ ERROR INFO: fread() returns 0 upon end of file or error. The functions ║
- ║ feof() and ferror() can be used to distinguish between ║
- ║ the two. In case of error, the global integer ERRNO ║
- ║ contains a code defining the error. ║
- ╟─────────────────────────────────────────────────────────────────────────────╢
- ║ LIBRARY: x.lib ║
- ╚═════════════════════════════════════════════════════════════════════════════╝
-